SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[usp_AddNewAdmin]
    (
      @fdAdminLoginID VARCHAR(50),
      @fdAdminPwd VARCHAR(50),
      @fdAdminName VARCHAR(50),
      @fdAdminMobile VARCHAR(20),
      @fdAdminEmail VARCHAR(50),
      @fdAdminPhone VARCHAR(20),
      @fdAdminStatus BIT,
      @fdAdminAddTime DATETIME,
      @fdAdminAddLoginID VARCHAR(50)
    )
AS 
    DECLARE @Count INT
    SET @Count = (
                   SELECT   COUNT(fdAdminLoginID)
                   FROM     dbo.JOL_Admin
                   WHERE    fdAdminLoginID = @fdAdminLoginID
                 )
    IF @Count = 0 
        INSERT  INTO dbo.JOL_Admin
                (
                  fdAdminLoginID,
                  fdAdminPwd,
                  fdAdminName,
                  fdAdminMobile,
                  fdAdminEmail,
                  fdAdminPhone,
                  fdAdminStatus,
                  fdAdminAddTime,
                  fdAdminAddLoginID
                )
        VALUES  (
                  @fdAdminLoginID, -- fdAdminLoginID - varchar(50)
                  @fdAdminPwd, -- fdAdminPwd - varchar(50)
                  @fdAdminName, -- fdAdminName - varchar(50)
                  @fdAdminMobile, -- fdAdminMobile - varchar(20)
                  @fdAdminEmail, -- fdAdminEmail - varchar(50)
                  @fdAdminPhone, -- fdAdminPhone - varchar(20)
                  @fdAdminStatus, -- fdAdminStatus - bit
                  GETDATE(), -- fdAdminAddTime - datetime
                  @fdAdminAddLoginID -- fdAdminAddLoginID - varchar(50)
                )
    ELSE 
        SELECT  '已存在相同账号的管理员账户，不能再添加'

GO
